{% extends './layout.html'%} {%block main%}
<style>
	.box {
		padding: 30px;
		background: #f7f7f7;
	}
	
	.box p {
		padding-top: 5px;
		padding-bottom: 5px;
	}
	
	.box .tle {
		font-weight: bold;
		margin-top: 15px;
	}
	
	h6 {
		display: block;
		margin-bottom: 10px;
	}
	    #pager{
        text-align: center;
    }
    
    
    .qianyue dt{
    	float: left;
    	clear: both;
    }
    .qianyue dd{
    	float: left;
    	margin-left: 10px;
		padding-bottom: 5px;

    }
    .qianyue{
    	display: none;
    }
</style>

<div class="box _panel" style='margin-top:20px;padding:20px !important;'>
	<form action="" class="layui-form">
		<input type="hidden" name="page" value="{{page}}" />


		<div class="layui-inline">
		
			<div class="layui-input-inline">
				<h6>状态</h6>
				<select name="status" lay-verify="" >
					<option value="-1" {{'selected' if status == -1}}>不限</option>
					<option value="0" {{'selected' if status == 0}}>未处理</option>
					<option value="1" {{'selected' if status == 1}}>已汇</option>
					<option value="2" {{'selected' if status == 2}}>已拒绝</option>
				</select>
			</div>
		</div>
		

		<div class="layui-inline" style=''>
			<h6>&nbsp;</h6>
			<a class="layui-btn layui-btn-normal" onclick='$("form").submit()'>查询</a>

		</div>

	</form>
	
	<table class="layui-table" style="margin-top:20px">
	<thead>
        <tr>
            <th width="2%">序号</th>
            <th width="18%">时间</th>
            <th width="15%">用户</th>
            <th width="15%">当前金额</th>
            <th width="15%">出金金额</th>
            <th width="15%">状态</th>
        </tr>
        {%for item in list%}
        <tr>
        	<td>
        		{{loop.index}}
        	</td>
        	<td>
        		{{item.add_time | fdate}}
        	</td>
        	<td>
        		{{item.proxy.nickname}}
        		{%if item.bindAccount%}
        		<a href="javascript:;" class="layui-btn layui-btn-mini" onclick='$(this).closest("tr").next().toggle()'>查看签约信息</a>
        		{%endif%}
        	</td>
        	<td>
        		{{item.proxy.money | money}}
        	</td>
        	<td>
				{{item.money | money}}        		
        	</td>
        	<td >
        		<select class="layui-input changeStatus" data-id='{{item.id}}' name="" lay-verify="" >
					<option value="0" {{'selected' if item.status == 0}}>未处理</option>
					<option value="1" {{'selected' if item.status == 1}}>已汇</option>
					<option value="2" {{'selected' if item.status == 2}}>已拒绝</option>
				</select>

        	</td>
        </tr>
        <tr class="qianyue">

        	<td colspan="100">
				<dl>
					<dt>银行卡开户名</dt>
					<dd>
						{{item.bindAccount.name}}
					</dd>
					<dt>
						银行卡号
					</dt>
					<dd>
						{{item.bindAccount.card}}
					</dd>
					<dt>
						银行名
					</dt>
					<dd>
						{{item.bindAccount.bank_master_name}}
					</dd>
					<dt>
						支行名
					</dt>
					<dd>
						{{item.bindAccount.bank_name}}
					</dd>
				</dl>


        	</td>
        </tr>
        {%endfor%}

	</table>
</div>

<div id='pager'></div>
{%endblock%}

{%block js%}
<script type="text/javascript" src="/static/js/util.js">
	
</script>
<script>
	layui.use(["laydate", "element", "form","laypage"], function(laydate, ele, form,laypage) {
		//执行一个laydate实例
		laydate.render({
			elem: '#start_time' //指定元素
		});

		laydate.render({
			elem: '#end_time' //指定元素
		});
		
		laypage.render({
			elem: 'pager',
			count: '{{count}}' ,//数据总数，从服务端得到
			limit:20	,
            curr :'{{page}}',
			jump: function(obj, first) {
				//obj包含了当前分页的所有参数，比如：
				console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
				console.log(obj.limit); //得到每页显示的条数

				//首次不执行
				if(!first) {
					$('input[name=page]').val(obj.curr);
					$("form").submit();
					//do something
				}
			}
		});
		
		
		$('.changeStatus').click(function(){
			var id = $(this).attr('data-id');
			$.post('/proxy/api/changeCashStatus',{id :id,value : this.value})
//			openWindow("添加出金","/proxy/add_cash.html");
		})
	});
</script>
{%endblock%}
